home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 62
/
Volume 62 - JOGO DISK .iso
/
Games
/
penguin_dinner.swf
/
scripts
/
__Packages
/
classes
/
ui
/
DayResult.as
< prev
next >
Wrap
Text File
|
2008-03-17
|
10KB
|
198 lines
class classes.ui.DayResult extends classes.ui.AbstractWidget
{
function DayResult()
{
super();
this.next_day_btn = this.part.next_day_btn;
this.upgrades_btn = this.part.upgrades_btn;
this.continue_btn = this.part.continue_btn;
this.next_stage_btn = this.part.next_stage_btn;
this.main_menu_btn = this.part.main_menu_btn;
this.submit_score_btn = this.part.submit_score_btn;
this.day_goal_caption = this.part.day_goal_caption;
this.day_earnings_caption = this.part.day_earnings_caption;
this.day_profit_caption = this.part.day_profit_caption;
this.total_profit_caption = this.part.total_profit_caption;
this.total_earnings_caption = this.part.total_earnings_caption;
this.day_goal_str = this.part.day_goal_str;
this.day_earnings_str = this.part.day_earnings_str;
this.day_profit_str = this.part.day_profit_str;
this.total_profit_str = this.part.total_profit_str;
this.total_earnings_str = this.part.total_earnings_str;
this.day_failed_caption = this.part.day_failed_caption;
this.day_win_caption = this.part.day_win_caption;
this.progress_saved_caption = this.part.progress_saved_caption;
this.day_failed_caption._visible = this.day_win_caption._visible = this.progress_saved_caption._visible = this.day_goal_caption._visible = this.day_earnings_caption._visible = this.day_profit_caption._visible = this.total_profit_caption._visible = this.total_earnings_caption._visible = this.day_goal_str._visible = this.day_earnings_str._visible = this.day_profit_str._visible = this.total_profit_str._visible = this.total_earnings_str._visible = false;
this.next_day_btn._visible = this.continue_btn._visible = this.next_stage_btn._visible = this.main_menu_btn._visible = this.submit_score_btn._visible = this.upgrades_btn._visible = false;
this.doLater(this.init);
classes.core.SoundManager.getInstance().startMusicTrack("splash_screen_track");
}
function init()
{
this.animator = new classes.core.Animator([this.blinds]);
this.blinds.animate(["state_close","state_fixed"]);
this.blinds.addEventListener(classes.movieclip.AnimatedClip.COMPLETE_SEQUENCE,this,"showResult");
this.startLocalLoop(this.update);
this.next_day_btn.addEventListener(classes.ui.TextButton.CLICK,this,"onButtonClick");
this.upgrades_btn.addEventListener(classes.ui.TextButton.CLICK,this,"onButtonClick");
this.continue_btn.addEventListener(classes.ui.TextButton.CLICK,this,"onButtonClick");
this.next_stage_btn.addEventListener(classes.ui.TextButton.CLICK,this,"onButtonClick");
this.main_menu_btn.addEventListener(classes.ui.TextButton.CLICK,this,"onButtonClick");
this.submit_score_btn.addEventListener(classes.ui.TextButton.CLICK,this,"onButtonClick");
var _loc2_ = 0;
while(_loc2_ < 6)
{
var _loc3_ = this["tip_btn_" + _loc2_];
_loc3_.enabled = false;
_loc3_.onRollOver = ru.inils.utils.ExtDelegate.create(this,this.onTipButtonClick,[_loc2_,_loc3_._y]);
_loc2_ = _loc2_ + 1;
}
}
function onTipButtonClick($tipIndex, $tipY)
{
this.tip._y = $tipY;
this.tip.show($tipIndex);
}
function onButtonClick(e)
{
switch(e.target)
{
case this.next_day_btn:
classes.core.Application.getInstance().gotoGameBoard();
break;
case this.continue_btn:
classes.core.Application.getInstance().gotoGameCompletedScreen();
break;
case this.next_stage_btn:
classes.core.Application.getInstance().gotoMapScreen();
break;
case this.upgrades_btn:
this.next_day_btn.lock();
this.upgrades_btn.lock();
this.main_menu_btn.lock();
var _loc2_ = classes.core.WidgetManager.getInstance();
this.upgradeShop = _loc2_.createWidget(classes.core.WidgetManager.WIDGET_UPGRADE_SHOP,this,1);
this.upgradeShop.addEventListener(classes.ui.AbstractWidget.DISPOSE,this,"onUpgradeShopDispose");
break;
case this.main_menu_btn:
classes.core.Application.getInstance().gotoToMainMenu();
break;
case this.submit_score_btn:
classes.utils.URLCaller.submitScore(classes.core.SOManager.getInstance().__get__totalScore());
}
}
function onUpgradeShopDispose()
{
this.total_profit_str.text = classes.utils.Utils.formattedCurrency(classes.core.SOManager.getInstance().__get__totalProfit());
}
function showResult()
{
classes.core.Application.getInstance().disposeGameBoard();
classes.core.WidgetManager.getInstance().unlockAllGlobal();
var _loc2_ = classes.core.SOManager.getInstance().__get__dayScore() - classes.game.GameData.__get__DAY_GOAL();
var _loc3_ = classes.utils.Utils.formattedCurrency(_loc2_);
if(_loc2_ < 0)
{
this.main_menu_btn._x = 390;
this.next_day_btn.__set__label("Restart day");
this.day_failed_caption._visible = true;
}
else
{
this.day_win_caption._visible = true;
}
classes.core.SOManager.getInstance().totalDaysPlaying = classes.core.SOManager.getInstance().totalDaysPlaying + 1;
this.localConv = com.potapenko.managers.Conv.create();
this.localConv.addPause(500);
this.localConv.put(this.day_goal_caption,"_visible",0,true);
this.localConv.put(this.day_goal_str,"_visible",0,true);
this.localConv.put(this.day_goal_str,"text",0,classes.utils.Utils.formattedCurrency(classes.game.GameData.__get__DAY_GOAL()));
this.localConv.put(this.tip_btn_0,"enabled",0,true);
this.localConv.put(classes.core.SoundManager.getInstance(),"startSound",0,"message_popup");
this.localConv.put(this,"showStarEffect",500,this.day_goal_str);
this.localConv.put(this.day_earnings_caption,"_visible",0,true);
this.localConv.put(this.day_earnings_str,"_visible",0,true);
this.localConv.put(this.day_earnings_str,"text",0,classes.utils.Utils.formattedCurrency(classes.core.SOManager.getInstance().__get__dayScore()));
this.localConv.put(this.tip_btn_1,"enabled",0,true);
this.localConv.put(classes.core.SoundManager.getInstance(),"startSound",0,"message_popup");
this.localConv.put(this,"showStarEffect",500,this.day_earnings_str);
this.localConv.put(this.day_profit_caption,"_visible",0,true);
this.localConv.put(this.day_profit_str,"_visible",0,true);
this.localConv.put(this.day_profit_str,"text",0,_loc3_);
this.localConv.put(this.tip_btn_2,"enabled",0,true);
this.localConv.put(classes.core.SoundManager.getInstance(),"startSound",0,"message_popup");
this.localConv.put(this,"showStarEffect",500,this.day_profit_str);
if(_loc2_ >= 0)
{
classes.core.SOManager.getInstance().currentDay = classes.core.SOManager.getInstance().currentDay + 1;
classes.core.SOManager.getInstance().totalProfit = classes.core.SOManager.getInstance().totalProfit + _loc2_;
classes.core.SOManager.getInstance().totalScore = classes.core.SOManager.getInstance().totalScore + classes.core.SOManager.getInstance().dayScore;
}
this.localConv.put(this.total_profit_caption,"_visible",0,true);
this.localConv.put(this.total_profit_str,"_visible",0,true);
this.localConv.put(this.total_profit_str,"text",0,classes.utils.Utils.formattedCurrency(classes.core.SOManager.getInstance().__get__totalProfit()));
this.localConv.put(this.tip_btn_3,"enabled",0,true);
this.localConv.put(classes.core.SoundManager.getInstance(),"startSound",0,"message_popup");
this.localConv.put(this,"showStarEffect",500,this.total_profit_str);
this.localConv.put(this.total_earnings_caption,"_visible",0,true);
this.localConv.put(this.total_earnings_str,"_visible",0,true);
this.localConv.put(this.total_earnings_str,"text",0,classes.utils.Utils.formattedCurrency(classes.core.SOManager.getInstance().__get__totalScore()));
this.localConv.put(this.tip_btn_4,"enabled",0,true);
this.localConv.put(classes.core.SoundManager.getInstance(),"startSound",0,"message_popup");
this.localConv.put(this,"showStarEffect",500,this.total_earnings_str);
if(_loc2_ < 0)
{
this.localConv.put(this.submit_score_btn,"unhide",0);
}
if(classes.core.SOManager.getInstance().__get__currentDay() == classes.game.GameData.__get__DAYS_AT_CURRENT_STAGE())
{
classes.core.SOManager.getInstance().__set__currentDay(0);
classes.core.SOManager.getInstance().currentStage = classes.core.SOManager.getInstance().currentStage + 1;
if(classes.core.SOManager.getInstance().__get__currentStage() == classes.game.GameData.TOTAL_STAGES)
{
this.localConv.put(this.continue_btn,"unhide",0);
classes.core.SOManager.getInstance().__set__gameCompleted(true);
}
else
{
this.localConv.put(this.next_stage_btn,"unhide",0);
this.localConv.put(this.upgrades_btn,"unhide",0);
this.localConv.put(this.main_menu_btn,"unhide",0);
this.localConv.put(this.progress_saved_caption,"_visible",0,true);
}
}
else
{
this.localConv.put(this.next_day_btn,"unhide",0);
this.localConv.put(this.upgrades_btn,"unhide",0);
this.localConv.put(this.main_menu_btn,"unhide",0);
this.localConv.put(this.progress_saved_caption,"_visible",0,true);
}
}
function showStarEffect(tf)
{
var _loc3_ = this.getNextHighestDepth();
var _loc4_ = {_x:tf._x + tf.textWidth / 2,_y:tf._y + tf.textHeight / 2};
this.attachMovie("star_anim_effect","sae_" + _loc3_,_loc3_,_loc4_);
}
function update()
{
this.animator.update();
}
function dispose()
{
this.animator.dispose();
this.next_day_btn.dispose();
this.upgrades_btn.dispose();
this.continue_btn.dispose();
this.next_stage_btn.dispose();
this.main_menu_btn.dispose();
this.submit_score_btn.dispose();
if(this.upgradeShop)
{
this.upgradeShop.dispose();
}
super.dispose();
}
}